package com.rookieci.lifegame;

import android.content.SharedPreferences;

public class SpUtils {
    private static SpUtils spUtils;
    private final SharedPreferences sp;

    public static synchronized SpUtils getInstance() {
        if (spUtils == null) spUtils = new SpUtils();
        return spUtils;
    }

    private SpUtils() {
        sp = MyApp.getInstance().getSharedPreferences("lifegame", 0);
    }

    public int getSize() {
        return sp.getInt("getSize", 10);
    }

    public void setSize(int size) {
        SharedPreferences.Editor edit = sp.edit();
        edit.putInt("getSize", size);
        edit.apply();
    }
}
